#pragma once
+#include "config.h"
+
#include <gio/gio.h>
#include "libglnx.h"
#ifdef HAVE_LIBARCHIVE
G_BEGIN_DECLS
#ifdef HAVE_LIBARCHIVE
-GLNX_DEFINE_CLEANUP_FUNCTION (void *, flatpak_local_free_write_archive, archive_write_free)
-#define ot_cleanup_write_archive __attribute__((cleanup (flatpak_local_free_write_archive)))
-
-GLNX_DEFINE_CLEANUP_FUNCTION (void *, flatpak_local_free_read_archive, archive_read_free)
-#define ot_cleanup_read_archive __attribute__((cleanup (flatpak_local_free_read_archive)))
-#else
-#define ot_cleanup_write_archive
-#define ot_cleanup_read_archive
+typedef struct archive OtAutoArchiveWrite;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(OtAutoArchiveWrite, archive_write_free)
+typedef struct archive OtAutoArchiveRead;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(OtAutoArchiveRead, archive_read_free)
#endif
G_END_DECLS
test_data_init (TestData *td)
{
GError *error = NULL;
- ot_cleanup_write_archive struct archive *a = archive_write_new ();
+ g_autoptr(OtAutoArchiveWrite) a = archive_write_new ();
struct archive_entry *ae;
uid_t uid = getuid ();
gid_t gid = getgid ();
{
TestData *td = (void*)data;
GError *error = NULL;
- ot_cleanup_read_archive struct archive *a = archive_read_new ();
+ g_autoptr(OtAutoArchiveRead) a = archive_read_new ();
OstreeRepoImportArchiveOptions opts = { 0, };
glnx_unref_object OstreeMutableTree *mtree = ostree_mutable_tree_new ();
{
TestData *td = (void*)data;
g_autoptr(GError) error = NULL;
- ot_cleanup_read_archive struct archive *a = archive_read_new ();
+ g_autoptr(OtAutoArchiveRead) a = archive_read_new ();
OstreeRepoImportArchiveOptions opts = { 0, };
glnx_unref_object OstreeMutableTree *mtree = ostree_mutable_tree_new ();
{
TestData *td = (void*)data;
g_autoptr(GError) error = NULL;
- ot_cleanup_read_archive struct archive *a = archive_read_new ();
+ g_autoptr(OtAutoArchiveRead) a = archive_read_new ();
OstreeRepoImportArchiveOptions opts = { 0, };
glnx_unref_object OstreeMutableTree *mtree = ostree_mutable_tree_new ();
{
TestData *td = (void*)data;
g_autoptr(GError) error = NULL;
- ot_cleanup_read_archive struct archive *a = archive_read_new ();
+ g_autoptr(OtAutoArchiveRead) a = archive_read_new ();
OstreeRepoImportArchiveOptions opts = { 0, };
if (skip_if_no_xattr (td))
{
TestData *td = (void*)data;
GError *error = NULL;
- ot_cleanup_read_archive struct archive *a = archive_read_new ();
+ g_autoptr(OtAutoArchiveRead) a = archive_read_new ();
OstreeRepoImportArchiveOptions opts = { 0, };
if (skip_if_no_xattr (td))
{
TestData *td = (void*)data;
GError *error = NULL;
- ot_cleanup_read_archive struct archive *a = archive_read_new ();
+ g_autoptr(OtAutoArchiveRead) a = archive_read_new ();
OstreeRepoImportArchiveOptions opts = { 0 };
OstreeRepoCommitModifier *modifier = NULL;
char buf[7] = { 0 };
entry_pathname_test_helper (gconstpointer data, gboolean on)
{
TestData *td = (void*)data; GError *error = NULL;
- ot_cleanup_read_archive struct archive *a = archive_read_new ();
+ g_autoptr(OtAutoArchiveRead) a = archive_read_new ();
OstreeRepoImportArchiveOptions opts = { 0, };
OstreeRepoCommitModifier *modifier = NULL;
gboolean met_etc_file = FALSE;
{
TestData *td = (void*)data;
GError *error = NULL;
- ot_cleanup_read_archive struct archive *a = archive_read_new ();
+ g_autoptr(OtAutoArchiveRead) a = archive_read_new ();
OstreeRepoImportArchiveOptions opts = { 0 };
glnx_unref_object OstreeSePolicy *sepol = NULL;
OstreeRepoCommitModifier *modifier = NULL;